package nl.myhealth.app.myhealthapp;

import android.app.Application;
import android.bluetooth.BluetoothSocket;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import nl.myhealth.app.myhealthapp.Adapter.Profile;
import nl.myhealth.app.myhealthapp.Measurement.Measurement;
import nl.myhealth.app.myhealthapp.Measurement.PressureMeasurment;
import nl.myhealth.app.myhealthapp.Measurement.PulseMeasurement;

/**
 * Created by Stephan E G Veenstra on 28-9-2014.
 */
public class MyHealthApplication extends Application {

    public static final String serviceURI = "http://segveenstra.nl/myhealth";

    public static String token;
    public static BluetoothSocket socket;

    private static List<Measurement> mokkupPulseMeasurements;
    private static List<Measurement> mokkupPressureMeasurements;

    private static Profile mokkupProfile;

    public static List<Measurement> getMokkupPulseMeasurements()
    {
        if(mokkupPulseMeasurements == null)
        {
            mokkupPulseMeasurements = new ArrayList<Measurement>();
            mokkupPulseMeasurements.add(new PulseMeasurement(new Date(), 100));
            mokkupPulseMeasurements.add(new PulseMeasurement(new Date(), 110));
            mokkupPulseMeasurements.add(new PulseMeasurement(new Date(), 104));
            mokkupPulseMeasurements.add(new PulseMeasurement(new Date(), 90));
            mokkupPulseMeasurements.add(new PulseMeasurement(new Date(), 88));
        }

        return mokkupPulseMeasurements;
    }
    
    public static List<Measurement> getMokkupPressureMeasurements()
    {
        if(mokkupPressureMeasurements == null)
        {
            mokkupPressureMeasurements = new ArrayList<Measurement>();
            mokkupPressureMeasurements.add(new PressureMeasurment(new Date(),160,80));
        }
        return mokkupPressureMeasurements;
    }

    public static Profile getMokkupProfile()
    {
        if(mokkupProfile == null)
        {
            mokkupProfile = new Profile();
            mokkupProfile.setFirstname("Stephan");
            mokkupProfile.setLastName("Veenstra");
            mokkupProfile.setEmail("seg.veenstra@gmail.com");
            mokkupProfile.setHealthInsurance("Zilveren Kruis");
        }
        return mokkupProfile;
    }

    public static void addPressureMeasurement(String json)
    {
        try{
            getMokkupPressureMeasurements().add(new PressureMeasurment(json));
        }catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
